<admintpl file="header" />
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="javascript:;">商讯管理</a></li>
        <li><a href="{:U('Adminbusinessnews/add')}" target="_self">添加商讯</a></li>
    </ul>
    <form class="well form-search" method="post" action="{:U('Adminbusinessnews/news_list')}">
        作者：
        <input type="text" name="author" style="width: 150px;" value="{$formget.author|default=''}" placeholder="请输入作者...">
        时间：
        <input type="text" name="start_time" class="js-datetime" value="{$formget.start_time|default=''}" style="width: 120px;" autocomplete="off">-
        <input type="text" class="js-datetime" name="end_time" value="{$formget.end_time|default=''}" style="width: 120px;" autocomplete="off"> &nbsp; &nbsp;
        关键字：
        <input type="text" name="keyword" style="width: 200px;" value="{$formget.keyword|default=''}" placeholder="请输入关键字...">
        <input type="submit" class="btn btn-primary" value="搜索" />
        <a class="btn btn-danger" href="{:U('Adminbusinessnews/news_list')}">清空</a>
    </form>

        <table class="table table-hover table-bordered table-list">
            <thead>
            <tr>
                <th width="50">排序</th>
                <th width="50">ID</th>
                <th>标题</th>
                <th width="50">作者</th>
                <!--<th width="50">点击量</th>-->
                <th width="160">关键词/来源/摘要/缩略图</th>
                <th width="100">发布时间</th>
                <th width="50">状态</th>
                <th width="70">操作</th>
            </tr>
            </thead>
            <foreach name="news" item="vo">
                <tr>
                    <td><input data-id="{$vo.id}" class="input input-order" type="text" size="5" value="{$vo.post_order}"></td>
                    <td>{$vo.id}</td>
                    <td>{$vo.post_title}</td>
                    <td>{$vo.user_nicename}</td>
                    <!--<td class="center">{$vo.post_hits}</td>-->
                    <td class="center">
                        <notempty name="vo.post_keywords">
                            <i class="fa fa-check fa-fw"></i>
                            <else/>
                            <i class="fa fa-close fa-fw"></i>
                        </notempty>
                        <notempty name="vo.post_source">
                            <i class="fa fa-check fa-fw"></i>
                            <else/>
                            <i class="fa fa-close fa-fw"></i>
                        </notempty>
                        <notempty name="vo.post_excerpt">
                            <i class="fa fa-check fa-fw"></i>
                            <else/>
                            <i class="fa fa-close fa-fw"></i>
                        </notempty>

                        <php>$smeta=json_decode($vo['smeta'],true);</php>
                        <notempty name="smeta.thumb">
                            <a href="javascript:parent.image_preview_dialog('{:sp_get_image_preview_url($smeta['thumb'])}');">
                                <i class="fa fa-photo fa-fw"></i>
                            </a>
                        </notempty>
                    </td>
                    <td>{:date('Y-m-d H:i',strtotime($vo['post_date']))}</td>
                    <td>
                        <php>$status = array('0' => '未审核', '1' => '正常', '2' => '审核未通过', '4' => '草稿')</php>
                        {$status[$vo['post_status']]}
                    </td>
                    <td>
                        <a href="{:U('Adminbusinessnews/edit_news', array('id' => $vo['id']))}">编辑</a> |
                        <a href="{:U('Adminbusinessnews/del_news', array('id' => $vo['id']))}" class="js-ajax-delete">删除</a>
                    </td>
                </tr>
            </foreach>
        </table>
        <div class="pagination">{$page}</div>
    </form>
</div>
<script src="__PUBLIC__/js/common.js"></script>
<script>
    $(document).ready(function () {
        $('body').delegate('.input-order', 'change', function () {
            var order 	= $(this).val();
            var id 		= $(this).attr('data-id');
            $.get("{:U('Portal/AdminPost/change_post_order')}", {id : id, order : order}, function (data) {
                if (data.status) {
                    window.location.reload();
                }
            })
        })
    })
</script>
</body>
</html>